<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php echo Yii::$app->name; ?> 后台管理</title>
        <?php $this->HeaderView(['slide']);?>
    </head>
    <body class="view_form" id="view_form_User">
        <form  id="view-form-form" action='<?php echo $this->createUrl('admin/repass'); ?>' method='post'  class="view-form-form">
<?= base\YiiMobo::csrfToken();?>
                <input type="hidden" class="input-text" id="username" name="Admin[username]" value="<?php echo yii::$app->user->identity->username ?>">
                    <table class="view-form-input" border="0" cellspacing="0" cellpadding="0" width="100%">
                        <tr>
                            <th valign="top" class="td-title"><label for="id">原密码：</label></th>
                            <td class="td-input"><input type="password" class="input-text" id="oldpass" name="Admin[oldpass]"></td>
                        </tr>
                        <tr>
                            <th valign="top" class="td-title"><label for="id">新密码：</label></th>
                            <td class="td-input"><input type="password" class="input-text" id="newpass" name="Admin[newpass]"></td>
                        </tr>
                        <tr>
                            <th valign="top" class="td-title"><label for="id">确认密码：</label></th>
                            <td class="td-input"><input type="password" class="input-text" id="renewpass" name="Admin[renewpass]"></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><br><input type="submit" value="修改" name="sbmt" class="btn-submit check"></td>
                                        </tr>
                                        </table>
                                        </form>
                                        <script>
                                            $(function() {
                                                $.validator.addMethod("different", function(value, element) {
                                                    return this.optional(element) || value != $('#oldpass').val();
                                                }, "格式不正确。");

                                                $("#view-form-form").validate({
                                                    //debug:true,
                                                    rules: {
                                                        "Admin[oldpass]": {
                                                            required: true
                                                        },
                                                        "Admin[newpass]": {
                                                            required: true,
                                                            minlength: 3,
                                                            different: true
                                                        },
                                                        "Admin[renewpass]": {
                                                            required: true,
                                                            equalTo: "#newpass"
                                                        }
                                                    },
                                                    messages: {
                                                        "Admin[oldpass]": {
                                                            required: "请输入原密码"
                                                        },
                                                        "Admin[newpass]": {
                                                            required: "请输入新密码",
                                                            minlength: "新密码不能少于3位",
                                                            different: '新密码与旧密码不能相同'
                                                        },
                                                        "Admin[renewpass]": {
                                                            required: "请输入确认密码",
                                                            equalTo: "与新密码不一致"
                                                        }
                                                    }
                                                });



                                                //添加位置导航文字 请修改
                                                admin_location('系统管理 > 修改密码');
                                            })
                                        </script>
                                        <?php $this->FooterView();?>
                                        </body>
                                        </html>